﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Example01.aspx.cs" Inherits="Chapter22.Example01" %>

<!DOCTYPE html>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>代码清单 22-1 对齐文本</title>
    <meta name="author" content="Adam Freeman" />
    <meta name="description" content="A simple example" />
    <link rel="shortcut ico" href="images/favicon.ico" type="image/x-ico" />
    <style type="text/css">
        #fruittext {
            width: 400px;
            margin: 5px;
            padding: 5px;
            border: medium double black;
            background-color: lightgray;
        }
    </style>
</head>
<body>
    <p id="fruittext">
        There are lots of different kinds of fruit - there are you over 500 varieties
        of banana alone. By the time we add the countless types of apples, oranges,
        and other well-known fruit, we are faced with thousands of choices.
        One of the most interesting aspects of fruit is the variety available in
        each county. I live near London, in an area which is know for
        its apples. 
    </p>
    <p>
        <button>Start</button>
        <button>End</button>
        <button>Left</button>
        <button>Right</button>
        <button>Justify</button>
        <button>Center</button>
    </p>
    <script>
        var buttons = document.getElementsByTagName("button");
        for (var i = 0; i < buttons.length; i++) {
            buttons[i].onclick = function (e) {
                var elements = document.getElementById("fruittext").style.textAlign = e.target.innerHTML;
            }
        }
    </script>
</body>
</html>
